package com.ruoyi.system.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.util.Date;

@Data
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class BUserVo {
    /**
     * id
     */
    private Long id;

    /**
     * openId
     */
    private String openid;

    /**
     * 称呼
     */
    private String name;

    /**
     * 手机号
     */
    private String mobile;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 密码
     */
    private String password;

    /**
     * 所属医院
     */
    private String hospital;

    /**
     * 职位
     */
    private String position;

    /**
     * 省份
     */
    private String province;

    /**
     * 城市
     */
    private String city;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 更新用户
     */
    private String updateBy;

    /**
     * 头像
     */
    private String avatar;

    /**
     * 创建者
     */
    private String createBy;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 备注
     */
    private String remark;

    /**
     * 总积分
     */
    private Integer totalScores;

    /**
     * 是否体验
     */
    private Integer isExperience;

    /**
     * 类型，0-任务，1-审核
     */
    private String roleType;

    /**
     * 问题数量
     */
    private Integer answerNum;

    /**
     * 解读数量
     */
    private Integer explainNum;

    /**
     * 案例数量
     */
    private Integer caseNum;

    /**
     * 完成数量
     */
    private Integer completeNum;

    private Integer taskNum;
    public Integer getTaskNum() {
        return (this.answerNum !=null?this.answerNum:0) + (this.explainNum!= null? this.explainNum :0)+ (this.caseNum != null?this.caseNum:0);
    }

    private String diffRate;

    public String getDiffRate() {
        Integer totalNum = (this.answerNum !=null?this.answerNum:0) + (this.explainNum!= null? this.explainNum :0)+ (this.caseNum != null?this.caseNum:0);
        double rate =  totalNum>0?((double) this.completeNum * 100.0/ totalNum):0;
        return String.format("%.2f", rate);
    }

}
